<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('审核用户')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-member-edit" th:object="${member}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户真实姓名：</label>
            <div class="col-sm-8">
                <input name="name" th:field="*{name}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">身份证号码：</label>
            <div class="col-sm-8">
                <input name="idCard" th:field="*{idCard}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否是内部人：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('member_inside')}">
                    <input type="radio" th:id="${'recommend_' + dict.dictCode}" name="isInside" th:value="${dict.dictValue}" th:field="*{isInside}">
                    <label th:for="${'recommend_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">身份证正面：</label>
            <div class="col-sm-8">
                <button type="button" class="layui-btn" id="upload_header">上传图片</button>
                <div class="layui-upload-list">
                    <div id="showHeader" style="padding: 5px;"><img th:src="*{cardHeaderImg}" style='height: 400px;width: 400px'></div>
                    <input type="hidden" id="cardHeaderImg" name="cardHeaderImg" th:field="*{cardHeaderImg}">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">身份证背面：</label>
            <div class="col-sm-8">
                <button type="button" class="layui-btn" id="upload_back">上传图片</button>
                <div class="layui-upload-list">
                    <div id="showBack" style="padding: 5px;"><img th:src="*{cardBackImg}" style='height: 400px;width: 400px'></div>
                    <input type="hidden" id="cardBackImg" name="cardBackImg" th:field="*{cardBackImg}">
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">审核：</label>
            <div class="col-sm-8">
                <select id="isExamine" name="isExamine" class="form-control m-b">
                    <option  value="2">通过</option >
                    <option  value="3">不通过</option >
                </select>
            </div>
        </div>
        <div id="scanner_reason" style="display: none">
            <div class="form-group">
                <label class="col-sm-3 control-label">原因：</label>
                <div class="col-sm-8">
                    <textarea name="reason" class="form-control"></textarea>
                </div>
            </div>
        </div>

    </form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    var prefix = ctx + "system/member";
    $("#form-member-edit").validate({
        focusCleanup: true
    });


    $("#isExamine").on("change",function(){
        if ($(this).val()==3){
            $("#scanner_reason").show();
        }else{
            $("#scanner_reason").hide();
        }
    });


    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/examine/edit", $('#form-member-edit').serialize());
        }
    }



    layui.use('upload', function() {
        var $ = layui.jquery
            , upload = layui.upload;

        //普通图片上传
        upload.render({
            elem: '#upload_header'
            , url: '/common/upload' //改成您自己的上传接口
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                //上传成功
                $("#showHeader ").html("<img src='" + res.url + "' style='width:80px;height:80px;'>");
                $("#cardHeaderImg").val(res.url);
            }
        });


        //普通图片上传
        upload.render({
            elem: '#upload_back'
            , url: '/common/upload' //改成您自己的上传接口
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                //上传成功
                $("#showBack ").html("<img src='" + res.url + "' style='width:80px;height:80px;'>");
                $("#cardBackImg").val(res.url);
            }
        });
    })


</script>
</body>
</html>